﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace GameJam
{

    public class PlayerBornCtrl : MonoBehaviour
    {
        private Animator animator;
        private ParticleSystem[] ps_list;
        // Use this for initialization
        void Start()
        {
            animator = GetComponentInChildren<Animator>();
            ps_list = GetComponentsInChildren<ParticleSystem>();
        }

        public void BornAnim(Color color)
        {
            foreach(ParticleSystem ps in ps_list)
            {
                ParticleSystem.MainModule mm = ps.main;
                mm.startColor = color;
                ps.Play();
            }

            animator.Play("born",0);
        }

        public float GetBornAnimTime()
        {
            AnimatorStateInfo state_info =  animator.GetCurrentAnimatorStateInfo(0);
           return  state_info.length;
        }
    }
}
